using System.Threading.Tasks;
using Project.Application.AccountApp.Dto;
using Project.Domain.AccountDomain;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Project.Application.AccountApp {
    public class AccountAppService : ApplicationService, IAccountAppService {
        public IRepository<Account> AccountRepo { get; }

        public AccountAppService (IRepository<Account> accountRepo) {
            AccountRepo = accountRepo;
        }

        public async Task<AccountDto> GetAccountByIdAsync (long id) {
            //var context = await _accountRepo.GetDbContextAsync ();
            var objAccount = await AccountRepo.FirstOrDefaultAsync (x => x.Id == id);
            return ObjectMapper.Map<Account, AccountDto> (objAccount);
        }
    }
}